<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../value/value_en.php";
} else if($lang == "VN") {
	include "../value/value_vn.php";
}
else {
	include "../value/value_kr.php";
}
include '../operations/connection.php';	

$assets=mysql_query("SELECT * FROM assets WHERE id=".$_REQUEST['id_assets']);
$group=0;
$isBorrow=array();
while ($r = mysql_fetch_array($assets)){
	$group=$r['group'];
	$type=$r['type'];
		$isBorrow=array($r['id'],$r['name'],$r['count'],$r['notuse'],$r['stock'],$r['note'],$r['value'],$r['place'],$r['memo']);
}
$group_assets=mysql_query("SELECT g.*,(SELECT COUNT(*) FROM assets a WHERE a.group=g.id ) as count FROM group_assets g ORDER BY g.name;");
$groupassets=array();
while ($r = mysql_fetch_array($group_assets)){
		$groupassets[]=array($r['id'],$r['name'],$r['count']);
}
$type_assets=mysql_query("SELECT t.*,(SELECT COUNT(*) FROM assets a WHERE a.type=t.id ) as count FROM type_assets t ORDER BY t.name;");
$typeassets=array();
while ($r = mysql_fetch_array($type_assets)){
		$typeassets[]=array($r['id'],$r['name'],$r['count']);
}
?>
			<input type="hidden" value="<?php echo $group;?>" name="idgroupAssets1" id="idgroupAssets1">
			<input type="hidden" value="<?php echo $type;?>" name="idtypeAssets1" id="idtypeAssets1">
			<input type="hidden" value="<?php echo $isBorrow[0];?>" name="idAssets1" id="idAssets1">
			   <table style=" padding-left:10px;">

							<tr >
								<td class="tdfirst"><?php echo $l_groupassets;?></td>
								<td >
								<select name="groupAssets1" id="groupAssets1" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
								<?php 
									$i=0;
									foreach ($groupassets as $value => $giatri)
									{
										?>
									<option value="<?php echo $giatri[0];?>" <?php if($group==$giatri[0]) echo 'selected="selected"';?>  ><?php echo $giatri[1];?></option>
									<?php 
										$i++;
									}
														
									?>
								</select>
							</tr >		
							<tr >
								<td  class="tdfirst"><?php echo $l_typeassets;?></td>
								<td>
								<select name="typeAssets1" id="typeAssets1" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
								<?php 
									$i=0;
									foreach ($typeassets as $value => $giatri)
									{
										?>
									<option value="<?php echo $giatri[0];?>" <?php if($type==$giatri[0]) echo 'selected="selected"';?> ><?php echo $giatri[1];?></option>
									<?php 
										$i++;
									}
														
									?>
								</select>
							</tr >		
							<tr >
								<td  class="tdfirst"><?php echo $l_nameassets;?></td>
								<td>
									<input type="text" name="nameAssets1" id="nameAssets1"  style="width:190px;float:left;height:20px;font-size: 13px;padding-left: 5px"  value="<?php echo $isBorrow[1];?>" />
								</td>
							</tr >			
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_using;?></td>
								<td>
									<input type="text" name="countAssets1" id="countAssets1" onKeyPress="return isNumberKey(event)" style="height: 20px;width: 30px;text-align: center;" value="<?php echo $isBorrow[2];?>" <?php /*if($isBorrow[2]!=$isBorrow[3]) echo "disabled='disabled'";*/?> >		
								</td>
							</tr >
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_notused;?></td>
								<td>
									<input type="text" name="notuseAssets1" id="notuseAssets1" onKeyPress="return isNumberKey(event)"  style="height: 20px;width: 30px;text-align: center;" value="<?php echo $isBorrow[3];?>" <?php /*if($isBorrow[2]==($isBorrow[3]+$isBorrow[4])) echo "disabled='disabled'";*/?> >		
								</td>
							</tr >
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_stock;?></td>
								<td>
									<input type="text" name="stockAssets1" id="stockAssets1" onKeyPress="return isNumberKey(event)" style="height: 20px;width: 30px;text-align: center;" value="<?php echo $isBorrow[4];?>" >		
								</td>
							</tr >
							
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_value;?></td>
								<td>
									<input type="text" name="valueAssets1" id="valueAssets1" onKeyPress="return isNumberKey(event)" style="height: 20px;width: 130px;text-align: left;" value="<?php echo number_format( $isBorrow[6]);?>" >		
								</td>
							</tr >
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_place;?></td>
								<td>
									<input type="text" name="placeAssets1" id="placeAssets1"  style="height: 20px;width: 270px;text-align: left;font-size: 13px;padding-left: 5px" value="<?php echo $isBorrow[7];?>" >		
								</td>
							</tr >
							
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_note;?></td>
								<td>
									<input type="text" name="noteAssets1" id="noteAssets1"  style="height: 20px;width: 270px;text-align: left;font-size: 13px;padding-left: 5px" value="<?php echo $isBorrow[5];?>" >		
								</td>
							</tr >
							<tr >
								<td  class="tdfirst" style="width: 180px"><?php echo $l_memo;?></td>
								<td>
									<textarea name="memoAssets1" id="memoAssets1"  style="height: 130px;width: 400px;text-align: left;font-size: 13px;padding-left: 5px"  ><?php echo $isBorrow[8];?></textarea>
								</td>
							</tr >
					</table>
					
<?php mysql_close($connection);?>